<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let myPro = (time) => {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve(time)
                }, time)
            })
        }

        /*  myPro(1000)
             .then(res1 => {
                 console.log(res1)
                 return myPro(res1 + 500)
             })
             .then(res2 => {
                 console.log(res2)
                 return myPro(res2 + 500)
             })
             .then(res3 => {
                 console.log(res3)
             }) */

        /* async function fn() {
            let res1 = await myPro(1000)
            console.log(res1)
            let res2 = await myPro(res1 + 500)
            console.log(res2)
            let res3 = await myPro(res2 + 500)
            console.log(res3)

        }
        fn() */
        /* 
                (async function fn() {
                    let res1 = await myPro(1000)
                    console.log(res1)
                    let res2 = await myPro(res1 + 500)
                    console.log(res2)
                    let res3 = await myPro(res2 + 500)
                    console.log(res3)
                }
                )() */

        (
            async function () {
                let res1 = await myPro(1000)
                console.log(res1)
                let res2 = await myPro(res1 + 500)
                console.log(res2)
                let res3 = await myPro(res2 + 500)
                console.log(res3)
            }
        )()

            (
                async function () {
                    let res1 = await myPro(1000)
                    console.log(res1)
                    let res2 = await myPro(res1 + 500)
                    console.log(res2)
                    let res3 = await myPro(res2 + 500)
                    console.log(res3)
                }
            )()
    </script>
</body>

</html>